@model Contrib.Chapters.ViewModels.MoveChapterViewModel
@using Contrib.Chapters.Models;

@using (Html.BeginFormAntiForgeryPost()) {
    @Html.ValidationSummary()
    <fieldset>
        @Html.Hidden("ChapterId", Model.ChapterId)
        <label for="@Html.FieldIdFor(m => m.SelectedChapterId)">@T("Parent chapter")</label>
        <select id="@Html.FieldIdFor(m => m.SelectedChapterId)" name="@Html.FieldNameFor(m => m.SelectedChapterId)">
            @Html.SelectOption(-1, false, T("- None -").ToString())
            @foreach (ChapterPart chapter in Model.Chapters) {
                <option @if (chapter.Id == Model.SelectedChapterId) { <text>selected="selected"</text> }  value="@chapter.Id">@for (var i = 1; i <= chapter.Level; i++) { <span class="gap">&nbsp;</span> }@chapter.Title</option>
            }
        </select> 
        <span class="hint">@T("By selecting a parent chapter you can create hierarchies")</span>

    </fieldset>
    <fieldset>
        <button class="primaryAction" type="submit">@T("Select")</button>
    </fieldset>
}